package com.flute.tools.util.performance;

import com.flute.tools.util.RegularExpressionUtil;

public class SearchTimeCollector implements ITimeCollector {
	private PerformanceResult result;

	public SearchTimeCollector() {

	}

	@Override
	public PerformanceResult getResult() {
		if (result == null) {
			result = new PerformanceResult(new Long[] { 10l, 20l }, 10);
		}

		return result;
	}

	@Override
	public long getTime(String content) {
		String[] ss = RegularExpressionUtil.getPatternValue(content,
				"耗时：(\\d*)");
		if (ss.length > 0) {
			content = ss[0].replace("耗时：", "");
			return Long.valueOf(content);
		} else {
			return -1;
		}
	}

}
